#define  _CRT_SECURE_NO_WARNINGS 1
/*
* NameL:test_2_8
* Purpose:Calculate the amount of the loan reamining after first,scond,and third month of payment.
* Author:zzr.
*/

#include <stdio.h>

int main(void)
{
	int amount_loan;
	int interest_rate;
	float monthly_payment;
	printf("Enter amount of the loan:");
	scanf("%d", &amount_loan);
	printf("Enter interest rate:");
	scanf("%d", &interest_rate);
	printf("Enter monthly paymment:");
	scanf("%f", &monthly_payment);

	float first_payment, second_payment, third_payment;
	first_payment = amount_loan - monthly_payment+amount_loan*((interest_rate)/100.0/12);
	second_payment = first_payment - monthly_payment + first_payment * ((interest_rate) / 100.0 / 12);
	third_payment = second_payment - monthly_payment + second_payment * ((interest_rate) / 100.0 / 12);

	printf("Balance remaining after first payment: $%.2f\n", first_payment);
	printf("Balance remaining after second payment: $%.2f\n", second_payment);
	printf("Balance remaining after third payment: $%.2f\n", third_payment);

    return 0;
}